package com.mentorgen.tools.util.profile.bundle.obsolete;

import java.io.PrintWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

class BundleBandwidthCollection {

	private static Map<String, BundleBandwidth> bundleMap = new HashMap<String, BundleBandwidth>();
	private static BundleBandwidthCollection sbcol = null;

	public static BundleBandwidthCollection getInstance(){
		if (sbcol == null)
			synchronized (BundleBandwidthCollection.class){
				if (sbcol == null){
					sbcol = new BundleBandwidthCollection();
				}
			}
		return sbcol;
	}

	public synchronized BundleBandwidth getSrvContainer(String id){

		BundleBandwidth sbc = bundleMap.get(id);
		if (sbc == null){
//			sbc = new BundleMeBandwidth(id);
			bundleMap.put(id, sbc);
		}
		return sbc;
	}

	public Collection<BundleBandwidth> getSrvContainerCollection(){
		return bundleMap.values();
	}

	public static void printInfo(PrintWriter pw){

		pw.println("------- Service Info ------ ");
		for (String id : bundleMap.keySet()){
			BundleBandwidth sbc = bundleMap.get(id);
			pw.println("BundleID" + id);
//			sbc.printServiceInfo(pw);
		}
	}
}
